import datetime
class categoryModel:
    categoryName = None
    categoryParentName = None
    
    def tojson(self):
        ret= {}
        for item,value in self.__dict__.items():
            ret[item]= value
        return ret
    
    def getObj(self,jsonStr):
        
        self.categoryName =  jsonStr['categoryName']
        self.categoryParentName = jsonStr['categoryParentName']
        return self


class movieModel:
    currentUrl= ''
    source = None
    sourceIndex = 0
    key= None
    movieData = {
        "img": "",
        "name": "",
        "remark": "",
        "alias": "",
        "director": "",
        "performer": "",
        "number": 0,
        "c_type": 0,
        "country": "",
        "language": "",
        "year": datetime.datetime.now().year,
        "update_date": datetime.datetime.now(),
        "tag": "",
        "description": "",
        "play_urls": []
    }

    def getObj(self,jsonStr):
        
        self.currentUrl=  jsonStr['currentUrl']
        self.source = jsonStr['source']
        self.sourceIndex = jsonStr['sourceIndex']
        self.key = jsonStr['key']
        self.movieData = jsonStr['movieData']
        return self

    def tojson(self):
        ret= {}
        for item,value in self.__dict__.items():
            ret[item]= value
        return ret
